package org.keshe.gui;

import javafx.fxml.FXMLLoader;
import javafx.scene.Scene;
import javafx.stage.Modality;
import javafx.stage.Stage;
import org.keshe.controllers.*;

import java.io.IOException;
import java.util.Objects;

public class PublicStages {
    public static Stage ADMINMENU = new Stage();
    public static Stage CHANGEPASSWD = new Stage();

    public static Stage ADMINSTUMANAGE = new Stage();

    public static Stage INSTU = new Stage();

    public static Stage OUTSTU = new Stage();

    /**
     * 加载管理员用户相关窗口
     * */
    public static void loadAdminStages() throws IOException {
        ADMINMENU.setTitle("学生宿舍管理系统 - 管理员");
        ADMINMENU.setScene(new Scene(FXMLLoader.load(
                Objects.requireNonNull(
                        AdminMenu.class.getResource("AdminMenu.fxml")))));

        ADMINMENU.setMinWidth(250);
        ADMINMENU.setMinHeight(280);

        CHANGEPASSWD.setTitle("修改密码");
        CHANGEPASSWD.setScene(new Scene(FXMLLoader.load(
                Objects.requireNonNull(
                        ChangePassWd.class.getResource("ChangePassWd.fxml")))));
        CHANGEPASSWD.setResizable(false);
        CHANGEPASSWD.initOwner(ADMINMENU);
        CHANGEPASSWD.initModality(Modality.APPLICATION_MODAL);

        ADMINSTUMANAGE.setTitle("学生信息管理");
        ADMINSTUMANAGE.setScene(new Scene(
                FXMLLoader.load(Objects.requireNonNull(
                        AdminStuManage.class.getResource("AdminStuManage.fxml")))));
        ADMINSTUMANAGE.initOwner(ADMINMENU);
        ADMINSTUMANAGE.initModality(Modality.APPLICATION_MODAL);

        INSTU.setTitle("学生入住");
        INSTU.setScene(new Scene(FXMLLoader.load(
                Objects.requireNonNull(
                        InStu.class.getResource("InStu.fxml")))));
        INSTU.initOwner(ADMINMENU);
        INSTU.initModality(Modality.APPLICATION_MODAL);
        INSTU.setMinHeight(300);
        INSTU.setMinWidth(300);

        OUTSTU.setTitle("学生退宿");
        OUTSTU.setScene(new Scene(FXMLLoader.load(
                Objects.requireNonNull(
                        OutStu.class.getResource("OutStu.fxml"))
        )));
        OUTSTU.initOwner(ADMINMENU);
        OUTSTU.initModality(Modality.APPLICATION_MODAL);
        OUTSTU.setMinHeight(300);
        OUTSTU.setMinWidth(300);
    }

    public static Stage MASTERMENU = new Stage();

    public static Stage THISBUILDINGSTU = new Stage();

    public static Stage ABNORMALINOUT = new Stage();
    public static void loadMasterStages() throws IOException{
        MASTERMENU.setTitle("学生宿舍管理系统 - 管理员");
        MASTERMENU.setScene(new Scene(FXMLLoader.load(
                Objects.requireNonNull(
                        MasterMenu.class.getResource("MasterMenu.fxml")))));

        MASTERMENU.setMinWidth(250);
        MASTERMENU.setMinHeight(280);

        CHANGEPASSWD.setTitle("修改密码");
        CHANGEPASSWD.setScene(new Scene(FXMLLoader.load(
                Objects.requireNonNull(
                        ChangePassWd.class.getResource("ChangePassWd.fxml")))));
        CHANGEPASSWD.setResizable(false);
        CHANGEPASSWD.initOwner(MASTERMENU);
        CHANGEPASSWD.initModality(Modality.APPLICATION_MODAL);

        THISBUILDINGSTU.setTitle("本栋学生名录");
        THISBUILDINGSTU.setScene(new Scene(
                FXMLLoader.load(
                        Objects.requireNonNull(
                                ThisBuildingStu.class.getResource("ThisBuildingStu.fxml")))
        ));
        THISBUILDINGSTU.initOwner(MASTERMENU);
        THISBUILDINGSTU.initModality(Modality.APPLICATION_MODAL);
        THISBUILDINGSTU.setMinHeight(300);
        THISBUILDINGSTU.setMinWidth(300);

        ABNORMALINOUT.setTitle("学生异常出入信息");
        ABNORMALINOUT.setScene(new Scene(
                FXMLLoader.load(
                        Objects.requireNonNull(
                                AbnormalInOut.class.getResource("AbnormalInOut.fxml")
                        )
                )
        ));
        ABNORMALINOUT.initOwner(MASTERMENU);
        ABNORMALINOUT.initModality(Modality.APPLICATION_MODAL);
        ABNORMALINOUT.setMinHeight(300);
        ABNORMALINOUT.setMinWidth(300);
    }
}
